<template>
	<view class="tutorial">
		<view class="list">
			<view class="list_item" v-for="(item,index) in list " :key="index" @click="toDetail(item.ID)">
				{{item.Title}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad(){
			this.getList()
		},
		methods:{
			async getList(){
				let res = await this.$api.post('Essay/GetEssayTitles')
				if (res.code == 0) {
					this.list = res?.data
				}
			},
			toDetail(id){
				uni.navigateTo({
					url:`/pages/otherPage/tutorialDetail?id=${id}`
				})
			}
		}
	}
</script>
<style>
	page {
		background-color: #f5f5f5;
	}
</style>

<style lang="scss" scoped>
	.list {
		display: flex;
		flex-direction: column;
		margin-top: 20rpx;
	}
	.list_item{
		height: 100rpx;
		display: flex;
		align-items: center;
		box-sizing: border-box;
		padding: 20rpx;
		background-color: #ffffff;
		border-bottom: 1px solid #f1f1f1;
	}
</style>